package com.gitee.smsdistribution.model;

import com.gitee.smsdistribution.validate.OnInsert;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import jakarta.persistence.UniqueConstraint;
import jakarta.validation.constraints.NotBlank;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Entity
@Table(name = "distribution_policy", uniqueConstraints=@UniqueConstraint(columnNames="name", name = "unique_name"))
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class DistributionPolicy {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Schema(name = "策略名称")
    @NotBlank(message = "策略名称不能为空", groups = OnInsert.class)
    private String name;

    @Schema(name = "策略网址")
    @NotBlank(message = "策略网址不能为空", groups = OnInsert.class)
    private String baseUrl;

    @Schema(name = "预览链接")
    private String previewLink;

    @Enumerated(EnumType.STRING)
    @Schema(name = "生成策略")
    @NotBlank(message = "生成策略不能为空", groups = OnInsert.class)
    private Strategy strategy;
}
